home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / oldwish / RCS / wishHandlers.c,v < prev    next >
Encoding:
Text File  |  1989-07-13  |  36.0 KB  |  1,428 lines

  1. head     1.4;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    mgbaker:1.4; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.4
  10. date     89.01.11.11.32.00;  author mlgray;  state Exp;
  11. branches ;
  12. next     1.3;
  13.  
  14. 1.3
  15. date     88.11.03.19.45.17;  author mlgray;  state Exp;
  16. branches ;
  17. next     1.2;
  18.  
  19. 1.2
  20. date     88.11.02.14.50.38;  author mlgray;  state Exp;
  21. branches ;
  22. next     1.1;
  23.  
  24. 1.1
  25. date     88.10.03.12.48.12;  author mlgray;  state Exp;
  26. branches ;
  27. next     ;
  28.  
  29.  
  30. desc
  31. @X11: works pretty much now.
  32. @
  33.  
  34.  
  35. 1.4
  36. log
  37. @Temporary checkin
  38. @
  39. text
  40. @/* 
  41.  * wishHandlers.c --
  42.  *
  43.  *    Event handlers and such for flat display.
  44.  *
  45.  * Copyright 1987 Regents of the University of California
  46.  * All rights reserved.
  47.  * Permission to use, copy, modify, and distribute this
  48.  * software and its documentation for any purpose and without
  49.  * fee is hereby granted, provided that the above copyright
  50.  * notice appear in all copies.  The University of California
  51.  * makes no representations about the suitability of this
  52.  * software for any purpose.  It is provided "as is" without
  53.  * express or implied warranty.
  54.  */
  55.  
  56. #ifndef lint
  57. static char rcsid[] = "$Header: /a/newcmds/wish/RCS/wishHandlers.c,v 1.3 88/11/03 19:45:17 mlgray Exp Locker: mlgray $ SPRITE (Berkeley)";
  58. #endif not lint
  59.  
  60. #include <sys/types.h>
  61. #include <sys/stat.h>
  62. #include "string.h"
  63. #include "util.h"
  64. #include "monitorClient.h"
  65. #include "wishInt.h"
  66.  
  67. extern    char    *wishStartUp;
  68.  
  69.  
  70. /*
  71.  *----------------------------------------------------------------------
  72.  *
  73.  * WishToggleSelection --
  74.  *
  75.  *    Toggle the selection status of an entry.  The event was selected in
  76.  *    the display window, but we are passed the surrounding window.
  77.  *
  78.  * Results:
  79.  *    None.
  80.  *
  81.  * Side effects:
  82.  *    If the coordinates are those of an entry, it is selected if it
  83.  *    wasn't already selected and it is de-selected if it was already
  84.  *    selected.
  85.  *
  86.  *----------------------------------------------------------------------
  87.  */
  88. void
  89. WishToggleSelection(window, eventPtr, lineP)
  90.     Window            window;
  91.     XButtonPressedEvent        *eventPtr;
  92.     Boolean            lineP;        /* double click for a line? */
  93. {
  94.     short    x, y;
  95.     WishWindow    *aWindow;
  96.     char    buffer[100];
  97.  
  98.     if (eventPtr->type != ButtonPress && eventPtr->type != ButtonRelease) {
  99.     return;
  100.     }
  101.  
  102.     if (XFindContext(wishDisplay, window, wishWindowContext,
  103.     (caddr_t) &aWindow) != 0) {
  104.     Sx_Panic(wishDisplay, "Wish didn't recognize given window.");
  105.     }
  106.  
  107.     /* the event was selected in the display window, so coordinates are ok */
  108.     x = ((XButtonEvent *) eventPtr)->x;
  109.     y = ((XButtonEvent *) eventPtr)->y;
  110.  
  111.     sprintf(buffer, "toggleSelection %d %d %d", x, y, lineP);
  112.  
  113.     (void) WishDoCmd(aWindow, buffer);
  114.  
  115.     return;
  116. }
  117.  
  118.  
  119. /*
  120.  *----------------------------------------------------------------------
  121.  *
  122.  * WishEditRule --
  123.  *
  124.  *    The user has typed something inside a group header entry window.
  125.  *    If he has typed a carriage return, then I take the new string and
  126.  *    try to make it the new selection rule for the window.  If there's
  127.  *    something wrong with the new rule, I tell the user and put back the
  128.  *    old rule. If the rule is ok, I ask him (or will do this soon) whether
  129.  *    he wants to make this rule permanent (put it in his .wish file).
  130.  *    Either way, I go and reselect stuff according to the new rule. For now
  131.  *    I do this the dumb way (I don't just redo the particular group --
  132.  *    I redo all groups), but I'll change it if it's too slow.
  133.  *
  134.  * Results:
  135.  *    None.
  136.  *
  137.  * Side effects:
  138.  *    Many.  Perhaps a new rule set, newly selected files, an edited .wish,
  139.  *    and a newly built display.
  140.  *
  141.  *----------------------------------------------------------------------
  142.  */
  143. void
  144. WishEditRule(window, eventPtr)
  145.     Window    window;
  146.     XKeyPressedEvent    *eventPtr;
  147. {
  148.     WishWindow    *aWindow;
  149.     WishGroup        *groupPtr;
  150.     Boolean        editRuleP = FALSE;
  151.     char        *mapping;
  152.     char        keyString[20];
  153.     int            length;
  154.     char        *buffer;
  155.  
  156.     if (eventPtr->type != KeyPress && eventPtr->type != KeyRelease) {
  157.     return;
  158.     }
  159.     if (XFindContext(wishDisplay, window, wishWindowContext,
  160.         (caddr_t) &aWindow) != 0) {
  161.     Sx_Panic(wishDisplay, "Wish didn't recognize given window.");
  162.     }
  163.     if (XFindContext(wishDisplay, window, wishGroupWindowContext,
  164.         (caddr_t) &groupPtr) != 0) {
  165.     Sx_Panic(wishDisplay, "Wish didn't recognize given header window.");
  166.     }
  167.     /* Check to see if they've typed a carriage return. */
  168.     length = XLookupString(eventPtr, keyString, 20, (KeySym *) NULL,
  169.         (XComposeStatus *) NULL);
  170.     
  171.     /* John does stuff here to force ctrl chars and meta bits.  Should I? */
  172.     for (mapping = keyString; length > 0; length--) {
  173.     if (*mapping++ == ctrl('m')) {
  174.         editRuleP = TRUE;
  175.         break;
  176.     }
  177.     }
  178.     if (editRuleP == FALSE) {
  179.     return;
  180.     }
  181.     if (groupPtr->defType != COMPARISON) {
  182.     sprintf(wishErrorMsg, "%s %s %s.", "Currently it is only possible to",
  183.         "edit the rules graphically for groups defined",
  184.         "with simple comparisons");
  185.     aWindow->notifierP = TRUE;
  186.     Sx_Notify(wishDisplay, aWindow->displayWindow, -1, -1, 0,
  187.         wishErrorMsg, NULL, TRUE, "Continue", NULL);
  188.     aWindow->notifierP = FALSE;
  189.     /* restore header */
  190.     strcpy(groupPtr->editHeader, groupPtr->rule);
  191.     Sx_EntryMake(wishDisplay, groupPtr->headerWindow, NULL,
  192.         aWindow->fontPtr, aWindow->foreground, aWindow->background,
  193.         groupPtr->editHeader, sizeof (groupPtr->editHeader));
  194.     return;
  195.     }
  196.     
  197.     buffer = (char *) malloc(strlen("changeGroup") + strlen(groupPtr->rule) +
  198.         strlen("comparison") + strlen(groupPtr->editHeader) + 4); 
  199.  
  200.     sprintf(buffer, "changeGroup %s %s %s", groupPtr->rule,
  201.         "comparison", groupPtr->editHeader);
  202.  
  203.     if (WishDoCmd(aWindow, buffer) != TCL_OK) {
  204.     /* restore header */
  205.     strcpy(groupPtr->editHeader, groupPtr->rule);
  206.     Sx_EntryMake(wishDisplay, groupPtr->headerWindow, NULL,
  207.         aWindow->fontPtr, aWindow->foreground, aWindow->background,
  208.         groupPtr->editHeader, sizeof (groupPtr->editHeader));
  209.     }
  210.  
  211.     free(buffer);
  212.  
  213.     return;
  214. }
  215.  
  216.  
  217.  
  218. /*
  219.  *----------------------------------------------------------------------
  220.  *
  221.  * WishEditDir --
  222.  *
  223.  *    The user has typed something in the directory name window.  If he
  224.  *    has typed a carriage return, then I look at the edited string and try to
  225.  *    make it the new dir of the display.  If the string isn't a valid
  226.  *    file or directory, then we notify them, and redisplay the current
  227.  *    dir. If a proper node has been chosen, call WishChangeDir() with it.
  228.  *    The event was selected in the title window, but the window we
  229.  *    are passed is the surrounding window.
  230.  *
  231.  * Results:
  232.  *    None.
  233.  *
  234.  * Side effects:
  235.  *    If a good dir was selected, it becomes the new dir of the display
  236.  *    and we redisplay.
  237.  *
  238.  *----------------------------------------------------------------------
  239.  */
  240. void
  241. WishEditDir(window, eventPtr)
  242.     Window        window;
  243.     XKeyPressedEvent    *eventPtr;
  244. {
  245.     struct    stat    dirAtts;
  246.     WishWindow    *aWindow;
  247.     int            length;
  248.     Boolean        editDirP = FALSE;
  249.     char        *mapping;
  250.     char        keyString[20];
  251.  
  252.     if (eventPtr->type != KeyPress && eventPtr->type != KeyRelease) {
  253.     return;
  254.     }
  255.     if (XFindContext(wishDisplay, window, wishWindowContext,
  256.         (caddr_t) &aWindow) != 0) {
  257.     Sx_Panic(wishDisplay, "Wish didn't recognize a given window.");
  258.     }
  259.     /* Check to see if they've typed a carriage return. */
  260.     length = XLookupString(eventPtr, keyString, 20, (KeySym *) NULL,
  261.         (XComposeStatus *) NULL);
  262.     /* John does stuff here to force ctrl chars and meta bits.  Should I? */
  263.     for (mapping = keyString; length > 0; length--) {
  264.     if (*mapping++ == ctrl('m')) {
  265.         editDirP = TRUE;
  266.         break;
  267.     }
  268.     }
  269.     if (editDirP == FALSE) {
  270.     return;
  271.     }
  272.     /*
  273.      * Put new dir name into canonical form.  If this fails, something is
  274.      * wrong with the new name and we restore the current good one in
  275.      * the title window.
  276.      */
  277.     if (Util_CanonicalDir(aWindow->editDir, aWindow->dir, aWindow->editDir) ==
  278.         NULL) {
  279.     /* error message returned in aWindow->editDir */
  280.     aWindow->notifierP = TRUE;
  281.     Sx_Notify(wishDisplay, aWindow->surroundingWindow, -1, -1, 0,
  282.         aWindow->editDir, NULL, TRUE, "Skip command", (char *) NULL);
  283.     aWindow->notifierP = FALSE;
  284.     strcpy(aWindow->editDir, aWindow->dir);
  285.     Sx_EntryMake(wishDisplay, aWindow->titleWindow, "Directory:  ",
  286.         aWindow->titleFontPtr, aWindow->foreground, aWindow->background,
  287.         aWindow->editDir, sizeof (aWindow->editDir));
  288.  
  289.     return;
  290.     }
  291.  
  292.     /*
  293.      * Check validity of the new dir.  If it's no good, restore the name
  294.      * of the old dir in the title window.
  295.      */
  296.     if (lstat(aWindow->editDir, &dirAtts)
  297.         != 0) {
  298.     sprintf(wishErrorMsg,
  299.         "Cannot switch to dir %s.  Maybe it doesn't exist?",
  300.         aWindow->editDir);
  301.     aWindow->notifierP = TRUE;
  302.     Sx_Notify(wishDisplay, aWindow->surroundingWindow, -1, -1, 0,
  303.         wishErrorMsg, NULL, TRUE, "Skip command", (char *) NULL);
  304.     aWindow->notifierP = FALSE;
  305.     strcpy(aWindow->editDir, aWindow->dir);
  306.     Sx_EntryMake(wishDisplay, aWindow->titleWindow, "Directory:  ",
  307.         aWindow->titleFontPtr, aWindow->foreground, aWindow->background,
  308.         aWindow->editDir, sizeof (aWindow->editDir));
  309.  
  310.     return;
  311.     }
  312.     if ((dirAtts.st_mode & S_IFMT) != S_IFDIR) {    /* not a directory */
  313.     sprintf(wishErrorMsg, "%s is not a directory.", aWindow->editDir);
  314.     aWindow->notifierP = TRUE;
  315.     Sx_Notify(wishDisplay, aWindow->surroundingWindow, -1, -1, 0,
  316.         wishErrorMsg, NULL, TRUE, "Skip command", (char *) NULL);
  317.     aWindow->notifierP = FALSE;
  318.     strcpy(aWindow->editDir, aWindow->dir);
  319.     Sx_EntryMake(wishDisplay, aWindow->titleWindow, "Directory:  ",
  320.         aWindow->titleFontPtr, aWindow->foreground, aWindow->background,
  321.         aWindow->editDir, sizeof (aWindow->editDir));
  322.     return;
  323.     }
  324.  
  325.     WishChangeDir(aWindow, aWindow->editDir);
  326.  
  327.     return;
  328. }
  329.  
  330.  
  331. /*
  332.  *----------------------------------------------------------------------
  333.  *
  334.  * WishChangeDir --
  335.  *
  336.  *     Make the directory of the display be the given directory "where".
  337.  *    If the current directory has been chosen, ignore it since this
  338.  *    won't change anything.  The directory "where" must already have
  339.  *    been canonicalized and checked for existence.
  340.  *
  341.  * Results:
  342.  *    None.
  343.  *
  344.  * Side effects:
  345.  *    If a new directory was selected, it becomes the new diretory of the
  346.  *    display    and we rebuild the display.  The title window is updated to
  347.  *    show the new directory.
  348.  *
  349.  *----------------------------------------------------------------------
  350.  */
  351. void
  352. WishChangeDir(aWindow, where)
  353.     WishWindow    *aWindow;
  354.     char        *where;        /* Careful -- this parameter may
  355.                      * be aWindow->editDir */
  356. {
  357.     static char     *command = "insert cd";
  358.     char        *insertcommand;
  359.  
  360.     /* if the dir has not changed, just return */
  361.     if (strcmp(aWindow->dir, where) == 0) {
  362.     /* Just refresh titleWindow */
  363.     strcpy(aWindow->editDir, aWindow->dir);
  364.     Sx_EntryMake(wishDisplay, aWindow->titleWindow, "Directory:  ",
  365.         aWindow->titleFontPtr, aWindow->foreground, aWindow->background,
  366.         aWindow->editDir, sizeof (aWindow->editDir));
  367.     return;
  368.     }
  369.  
  370.     if (chdir(where) != 0) {
  371.     sprintf(wishErrorMsg, "Couldn't change directories to %s", where);
  372.     Sx_Panic(wishDisplay, wishErrorMsg);
  373.     }
  374.     if (!MonClient_ChangeDir(aWindow->dir, where)) {
  375.     sprintf(wishErrorMsg, "WishChangeDir: %s",
  376.         "Changing directories in file system monitor failed.");
  377.     Sx_Panic(wishDisplay, wishErrorMsg);
  378.     }
  379.  
  380.     strcpy(aWindow->dir, where);
  381.     /* Change the title to new dir */
  382.     strcpy(aWindow->editDir, aWindow->dir);
  383.     Sx_EntryMake(wishDisplay, aWindow->titleWindow, "Directory:  ",
  384.         aWindow->titleFontPtr, aWindow->foreground, aWindow->background,
  385.         aWindow->editDir, sizeof (aWindow->editDir));
  386.  
  387.     /* for window icon */
  388.     XStoreName(wishDisplay, aWindow->surroundingWindow, aWindow->dir); 
  389.  
  390.     WishGarbageCollect(aWindow);
  391.     /* delete old interpreter and start new one? */
  392.     strcpy(wishCurrentDirectory, aWindow->dir);
  393.  
  394.     WishSourceConfig(aWindow);
  395.  
  396.     aWindow->firstElement = 1;        /* start displaying from beginning */
  397.     WishSetPositions(aWindow);
  398.     /* WishRedraw will be called from event caused in WishSetPositions() */
  399.     /* throw a cd into tx window, if there is one.  +4 for space,'\n', & '\0' */
  400.     insertcommand = (char *) malloc(strlen(command) +
  401.         strlen(wishCurrentDirectory) + 4);
  402.     sprintf(insertcommand, "%s %s\\n", command, wishCurrentDirectory);
  403.     Tx_Command(wishDisplay, aWindow->txOutsideWindow, insertcommand);
  404.     free(insertcommand);
  405.  
  406.     return;
  407. }
  408.  
  409.  
  410. /*
  411.  *----------------------------------------------------------------------
  412.  *
  413.  * WishSourceConfig --
  414.  *
  415.  *     Source the config files to rebuild the display.
  416.  *
  417.  * Results:
  418.  *    None.
  419.  *
  420.  * Side effects:
  421.  *    After a redisplay, anything could be different.
  422.  *
  423.  *----------------------------------------------------------------------
  424.  */
  425. void
  426. WishSourceConfig(aWindow)
  427.     WishWindow    *aWindow;
  428. {
  429.     char    *environVar;
  430.     char    string[MAXPATHLEN];
  431.     struct    stat    attrs;
  432.     struct    stat    localAttrs;
  433.     FILE    *test1;
  434.     FILE    *test2;
  435.  
  436.     /*
  437.      * This prevents things that would change the display from doing so
  438.      * until a desired redraw event.
  439.      */
  440.     aWindow->dontDisplayChangesP = TRUE;
  441.     /*
  442.      * The implicit assumption here is that we always try to read a
  443.      * .wish file in the user's home directory.  Then we try to
  444.      * read one in the local directory, if it is different from the home
  445.      * directory.  The local one can override things in the home directory
  446.      * .wish file.  I find this awkward.  I think that it should look first for
  447.      * a local one and tbe local one could source the .wish in the home
  448.      * directory, if the user wishes.  But this is to keep wish compatible
  449.      * with mx and things.
  450.      */
  451.     environVar = (char *) getenv("HOME");
  452.     if (environVar != NULL) {
  453.     strcpy(string, environVar);
  454.     strcat(string, "/.wish");
  455. /*
  456.     sprintf(string, "%s/.wish", environVar);
  457. */
  458.     /*
  459.      * use open instead of access to test read permission with
  460.      * effictive, rather than real, uid.  How wasteful.
  461.      */
  462.     if ((test1 = fopen(string, "r")) != NULL) {
  463.         (void) stat(string, &attrs);
  464.         sprintf(string, "source %s/.wish", environVar);
  465.         (void) WishDoCmd(aWindow, string);
  466.         (void) fclose(test1);
  467.     }
  468.     }
  469.     /* Make sure we don't source the same file twice */
  470.     /* What if results of void'd WishDoCmd()'s were not TCL_OK? */
  471.  
  472.     /*
  473.      * use open instead of access to test read permission with
  474.      * effictive, rather than real, uid.  How wasteful.
  475.      */
  476.     if ((test2 = fopen(".wish", "r")) != NULL) {
  477.     (void) stat(".wish", &localAttrs);
  478.     if (attrs.st_ino != localAttrs.st_ino ||
  479.         attrs.st_dev != localAttrs.st_dev ||
  480.         attrs.st_serverID != localAttrs.st_serverID) {
  481.         (void) WishDoCmd(aWindow, "source .wish");
  482.     }
  483.     (void) fclose(test2);
  484.     }
  485.     /*
  486.      * If there wasn't a user startup file, get the defaults.
  487.      */
  488.     if (test1 == NULL && test2 == NULL) {
  489. /*
  490.     sprintf(string, "%s/.wish", wishStartUp);
  491. */
  492.     strcpy(string, wishStartUp);
  493.     strcat(string, "/.wish");
  494.     if ((test1 = fopen(string, "r")) != NULL) {
  495.         (void) stat(string, &attrs);
  496.         sprintf(string, "source %s/.wish", wishStartUp);
  497.         (void) WishDoCmd(aWindow, string);
  498.         (void) fclose(test1);
  499.     } else {
  500.         Sx_Panic("No .wish file found anywhere.  There should at least be one in the same directory as the wish executable. ");
  501.     }
  502.     }
  503.  
  504.     /* If no groups from startup files, then get default "*" group. */
  505.     if (aWindow->groupList == NULL) {
  506.     if (WishGatherNames(aWindow) != TCL_OK) {
  507.         /* fix here too */
  508.     }
  509.     }
  510.  
  511.     /* now that we're finished sourcing the file, it's okay to update things. */
  512.     aWindow->dontDisplayChangesP = FALSE;
  513.  
  514.     return;
  515. }
  516.  
  517.  
  518.  
  519. /*
  520.  *----------------------------------------------------------------------
  521.  *
  522.  * WishHandleDrawingEvent --
  523.  *
  524.  *    Handle an event that requires drawing the display again.
  525.  *
  526.  * Results:
  527.  *    None.
  528.  *
  529.  * Side effects:
  530.  *    The display is drawn again.  If the window has changed size,
  531.  *    the diplay may be different.
  532.  *
  533.  *----------------------------------------------------------------------
  534.  */
  535. void
  536. WishHandleDrawingEvent(aWindow, eventPtr)
  537.     WishWindow    *aWindow;
  538.     XExposeEvent    *eventPtr;
  539. {
  540.     int    height, width, dummy1;
  541.     Window    dummy2;
  542.     char    buffer[100];
  543.  
  544.     /* ignore events from child windows */
  545.     if (eventPtr->window != aWindow->surroundingWindow && eventPtr->window !=
  546.         aWindow->displayWindow) {
  547.     return;
  548.     }
  549.     switch(eventPtr->type) {
  550.     /* This would only report a child resized, anyway, no? */
  551.     case ConfigureNotify:
  552.     case MapNotify:
  553.     XGetGeometry(wishDisplay, aWindow->displayWindow, &dummy2,
  554.         &dummy1, &dummy1, &width, &height, &dummy1, &dummy1);
  555.     if (width != aWindow->windowWidth || height != aWindow->windowHeight) {
  556.         sprintf(buffer, "resize %d %d", height, width);
  557.         (void) WishDoCmd(aWindow, buffer);
  558.         return;
  559.     }
  560.     strcpy(buffer, "redraw");
  561.     (void) WishDoCmd(aWindow, buffer);
  562.     return;
  563.     case Expose:
  564.     /*
  565.      * Only redraw on the last expose event.
  566.      */
  567.     if (eventPtr->count != 0) {
  568.         return;
  569.     }
  570.     strcpy(buffer, "redraw");
  571.     (void) WishDoCmd(aWindow, buffer);
  572.     return;
  573.     default:
  574.     return;
  575.     }
  576. }
  577.  
  578.  
  579.  
  580. /*
  581.  *----------------------------------------------------------------------
  582.  *
  583.  * WishHandleDestructionEvent --
  584.  *
  585.  *    Not yet implemented.  Should do garbage collection and such
  586.  *    once I have got that in place.
  587.  *
  588.  * Results:
  589.  *    None.
  590.  *
  591.  * Side effects:
  592.  *    None.
  593.  *
  594.  *----------------------------------------------------------------------
  595.  */
  596. /*ARGSUSED*/
  597. void
  598. WishHandleDestructionEvent(aWindow, eventPtr)
  599.     WishWindow    *aWindow;
  600.     XExposeEvent    *eventPtr;
  601. {
  602.     return;
  603. }
  604.  
  605.  
  606. /*
  607.  *----------------------------------------------------------------------
  608.  *
  609.  * WishMouseEvent --
  610.  *
  611.  *    This routine implements the bindings of various mouse
  612.  *    buttons to various commands.  This routine is temporary and will
  613.  *    go away when the command bindings stuff is done.
  614.  *
  615.  * Results:
  616.  *    None.
  617.  *
  618.  * Side effects:
  619.  *    If a command was chosen, it is executed.
  620.  *
  621.  *----------------------------------------------------------------------
  622.  */
  623. void
  624. WishMouseEvent(window, eventPtr)
  625.     Window        window;        /* the surrounding window */
  626.     XButtonEvent    *eventPtr;
  627. {
  628.     static    int    lastWindow = 0;
  629.     static    int    lastTime = 0;
  630.     static    int    repeatCount = 0;
  631.     static    int    lastX = -1;
  632.     static    int    lastY = -1;
  633.     int        x, y;
  634.     WishFile    *filePtr;
  635.     WishGroup    *groupPtr;
  636.     WishWindow    *aWindow;
  637.     int        button = 0;
  638.     char    *selectButton = NULL;
  639.     char    *command;
  640.     char    buffer[100];
  641.  
  642.  
  643. #define    DETAIL_MASK    7
  644.  
  645.     if (eventPtr->subwindow != NULL) {
  646.     return;
  647.     }
  648.     switch (eventPtr->type) {
  649.     case MotionNotify:
  650.     case LeaveNotify:
  651.     /* Highlight mouse movement */
  652.     WishHighlightMovement(window, eventPtr);
  653.     return;
  654.     case ButtonPress:
  655.     break;
  656.     default:
  657.     return;
  658.     }
  659.     /* Left button is Button1? */
  660.     if ((eventPtr->button & DETAIL_MASK) == Button1) {
  661.     button |= WISH_LEFT_BUTTON;
  662.     }
  663.     if ((eventPtr->button & DETAIL_MASK) == Button2) {
  664.     button |= WISH_MIDDLE_BUTTON;
  665.     }
  666.     if ((eventPtr->button & DETAIL_MASK) == Button3) {
  667.     button |= WISH_RIGHT_BUTTON;
  668.     }
  669.     /* What to do about meta, shift and double buttons??? */
  670.  
  671.     /*
  672.      * See which group, if any, button is over.  See if it matches a
  673.      * button binding for that group.  If not, see if it matches
  674.      * the selection button.
  675.      */
  676.     
  677.     /* the event was selected in the display window, so coordinates are ok */
  678.     x = ((XButtonEvent *) eventPtr)->x;
  679.     y = ((XButtonEvent *) eventPtr)->y;
  680.  
  681.     if (XFindContext(wishDisplay, window, wishWindowContext,
  682.         (caddr_t) &aWindow) != 0) {
  683.     Sx_Panic(wishDisplay, "Wish didn't recognize given window.");
  684.     }
  685.     filePtr = WishMapCoordsToFile(aWindow, x, y);
  686.     if (filePtr != NULL) {
  687.     groupPtr = filePtr->myGroupPtr;
  688.     command = WishGetGroupBinding(groupPtr, button);
  689.     if (command != NULL) {
  690.         Tcl_SetVar(aWindow->interp, "pointed", filePtr->name, 1);
  691.         /* do it */
  692.         (void) WishDoCmd(aWindow, command);
  693.     }
  694.     }
  695.     /* No command, see if selection was meant */
  696.     
  697.     
  698.     /*
  699.      * See if button matches selection button.
  700.      * What do I do about meta's and shifts and such???
  701.      */
  702.     selectButton = Tcl_GetVar(aWindow->interp, "selectionButton", 1);
  703.     if (selectButton == NULL || selectButton[0] == '\0') {
  704.     Tcl_SetVar(aWindow->interp, "selectionButton", "left", 1);
  705.     if (button != WISH_LEFT_BUTTON) {    /* not selection */
  706.         return;
  707.     }
  708.     } else {
  709.     if (button != WishWhichButton(selectButton)) {    /* not select.*/
  710.         return;
  711.     }
  712.     }
  713.  
  714.     /* Prof. Ousterhout does drag scrolling here if the shift key is down */
  715.  
  716.     /* Count the number of clicks in the same place. */
  717.     if (lastWindow == window && ((eventPtr->time - lastTime) < 50) &&
  718.         ((lastX + 2) >= eventPtr->x) && ((lastX - 2) <= eventPtr->x) &&
  719.         ((lastY + 2) >= eventPtr->y) && ((lastY - 2) <= eventPtr->y)) {
  720.     repeatCount += 1;
  721.     if (repeatCount > 2) {
  722.         repeatCount = 1;
  723.     }
  724.     } else {
  725.     repeatCount = 1;
  726.     }
  727.     lastX = eventPtr->x;
  728.     lastY = eventPtr->y;
  729.     lastTime = eventPtr->time;
  730.     lastWindow = window;
  731.     switch (repeatCount) {
  732.     case 2:
  733.     /* select line */
  734.     sprintf(buffer, "toggleSelection %d %d 1", x, y);
  735.     (void) WishDoCmd(aWindow, buffer);
  736. /*    old...
  737.     WishToggleSelection(window, eventPtr, TRUE);
  738.  */
  739.     break;
  740.     default:
  741.     /* select filename */
  742.     sprintf(buffer, "toggleSelection %d %d 0", x, y);
  743.     (void) WishDoCmd(aWindow, buffer);
  744. /*    old...
  745.     WishToggleSelection(window, eventPtr, FALSE);
  746.  */
  747.     break;
  748.     }
  749.     return;
  750. }
  751.  
  752.  
  753. /*
  754.  *----------------------------------------------------------------------
  755.  *
  756.  * WishHandleEnterEvent --
  757.  *
  758.  *    The mouse has entered a window.  Make sure that the current directory
  759.  *    of the program is the directory of that window.
  760.  *
  761.  * Results:
  762.  *    None.
  763.  *
  764.  * Side effects:
  765.  *    The current directory of the program will change to that of the
  766.  *    window, if it is different.
  767.  *
  768.  *----------------------------------------------------------------------
  769.  */
  770. void
  771. WishHandleEnterEvent(aWindow, eventPtr)
  772.     WishWindow    *aWindow;
  773.     XEnterWindowEvent    *eventPtr;
  774. {
  775.     if (eventPtr->type != EnterNotify) {
  776.     return;
  777.     }
  778.     if (strcmp(wishCurrentDirectory, aWindow->dir) == 0) {
  779.     return;
  780.     }
  781.     if (chdir(aWindow->dir) != 0) {
  782.     sprintf(wishErrorMsg, "%s %s.  %s %s",
  783.         "Couldn't change back to directory", aWindow->dir,
  784.         "Does it still exist?  This window no longer makes sense",
  785.         "and will now disappear.");
  786.     aWindow->notifierP = TRUE;
  787.     Sx_Notify(wishDisplay, aWindow->displayWindow, -1, -1, 0,
  788.         wishErrorMsg, NULL, TRUE, "Continue", NULL);
  789.     aWindow->notifierP = FALSE;
  790.     (void) WishDoCmd(aWindow, "close");
  791.     return;
  792.     }
  793.     strcpy(wishCurrentDirectory, aWindow->dir);
  794.  
  795.     return;
  796. }
  797.  
  798.  
  799.  
  800. /*
  801.  *----------------------------------------------------------------------
  802.  *
  803.  * WishKeyProc --
  804.  *
  805.  *    This procedure is invoked by the Sx dispatcher whenever a
  806.  *    key is typed in an Wish window.
  807.  *
  808.  * Results:
  809.  *    None.
  810.  *
  811.  * Side effects:
  812.  *    Can be almost arbitrary.  Depends completely on the key.
  813.  *
  814.  *----------------------------------------------------------------------
  815.  */
  816. void
  817. WishKeyProc(aWindow, eventPtr)
  818.     WishWindow    *aWindow;    /* Keeps track of information for
  819.                      * window. */
  820.     XKeyEvent *eventPtr;        /* Describes key that was pressed. */
  821. {
  822.     char    keyString[20];
  823.     char    *command, *mapping;
  824.     register    char    c;
  825.     int        result, nBytes;
  826.     Boolean    undo = TRUE;
  827.     char    insertCommand[20];
  828.     Window    w;
  829.  
  830.     w = aWindow->surroundingWindow;
  831.     if (eventPtr->subwindow != NULL) {
  832.     return;
  833.     }
  834.  
  835.     /*
  836.      * Convert from raw key number to its ASCII equivalent, then pass
  837.      * each equivalent character to the keystroke binder.  Process
  838.      * any commands that are matched this way.
  839.      */
  840.     
  841.     nBytes = XLookupString(eventPtr, keyString, 20, (KeySym *) NULL,
  842.         (XComposeStatus *) NULL);
  843.     /* John does stuff here to force ctrl chars and meta bits.  Should I? */
  844.     for (mapping = keyString; nBytes > 0; nBytes--, mapping++) {
  845.     result = Cmd_MapKey(aWindow->cmdTable, *mapping, &command);
  846.     if (result == CMD_PARTIAL) {
  847.         continue;
  848.     } else if (result == CMD_UNBOUND) {
  849.         char    msg[30];
  850.  
  851.         WishCvtToPrintable(command, 30, msg);
  852. #ifdef NOTDEF
  853.         if (aWindow->msgWindow != NULL) {
  854. #endif NOTDEF
  855.         sprintf(wishErrorMsg,
  856.             "The keystroke sequence \"%s\" has no function.", msg);
  857.         aWindow->notifierP = TRUE;
  858.         Sx_Notify(wishDisplay, w, -1, -1, 0, wishErrorMsg,
  859.             aWindow->fontPtr, TRUE, "Continue", (char *) NULL);
  860.         aWindow->notifierP = FALSE;
  861.         return;
  862. #ifdef NOTDEF
  863.         } else {
  864.         sprintf(wishErrorMsg,
  865.             "The keystroke sequence\n\"%s\"\nhas no function.",
  866.             msg);
  867.         aWindow->notifierP = TRUE;
  868.         (void) Sx_Notify(wishDisplay, aWindow->surroundingWindow,
  869.             -1, -1, 0, wishErrorMsg, aWindow->fontPtr, TRUE,
  870.             "Ignore and go on", NULL);
  871.         aWindow->notifierP = FALSE;
  872.         }
  873.         break;
  874. #endif NOTDEF
  875.     } else if (result == CMD_OK) {
  876.         if (*command == '!') {
  877.         undo = FALSE;
  878.         command++;
  879.         } else {
  880. #ifdef NOTDEF
  881.         Undo_Mark(aWindow->fileInfoPtr->log);
  882. #endif NOTDEF
  883.         }
  884.  
  885.         /*
  886.          * If the command is "@@", then generate an insert command for
  887.          * the last character typed.
  888.          */
  889.  
  890.         if ((command[0] == '@@') && (command[1] == 0)) {
  891.         c = *mapping;
  892.         if (isprint(c) && !isspace(c) && (c != '\\')
  893.             && (c != '"') && (c != ';') && (c != '$')) {
  894.             sprintf(insertCommand, "ins %c", c);
  895.         } else {
  896.             int i = c & 0xff;
  897.  
  898.             sprintf(insertCommand, "ins \\%o", i);
  899.         }
  900.         command = insertCommand;
  901.         }
  902.  
  903.         (void) WishDoCmd(aWindow, command);
  904. #ifdef NOTDEF
  905.  
  906.         /*
  907.          * Watch out!  The command could have destroyed the window.
  908.          */
  909.     
  910.         if (MxGetMxWindow(w) != aWindow) {
  911.         return;
  912.         }
  913. #endif NOTDEF
  914.     }
  915.     }
  916. }
  917.  
  918.  
  919.  
  920. /*
  921.  *----------------------------------------------------------------------
  922.  *
  923.  * WishHandleMonitorUpdates --
  924.  *
  925.  *    This routine should be called whenever the monitor informs us
  926.  *    that a change has occured in a directory we are viewing.
  927.  *    Note that the directory-changing code here is almost identical to
  928.  *    that in WishHandlerEnterEvent().  This means I should have
  929.  *    it as a separate routine, soon.
  930.  *
  931.  * Results:
  932.  *    None.
  933.  *
  934.  * Side effects:
  935.  *    The given window will be updated.
  936.  *
  937.  *----------------------------------------------------------------------
  938.  */
  939. void
  940. WishHandleMonitorUpdates()
  941. {
  942.     int    windowID;
  943.     int    cc;
  944.     char    *ptr;
  945.     int        numbytes;
  946.     WishWindow    *aWindow;
  947.     int        firstElement;
  948. #ifdef MON_DEBUG
  949.     char    buffer[MAXPATHLEN + 1];
  950. #endif MON_DEBUG
  951.  
  952.     ptr = (char *) (&windowID);
  953.     numbytes = sizeof (windowID);
  954.     cc = 0;
  955.     for ( ; cc != -1 && cc < numbytes; numbytes -= cc, ptr += cc) {
  956.     cc = read(monClient_ReadPort, ptr, numbytes);
  957.     }
  958.     if (cc == -1) {
  959.     perror("WishHandleMonitorUpdates, windowID read: ");
  960.     exit(1);
  961.     }
  962.  
  963. #ifdef MON_DEBUG
  964.     ptr = buffer;
  965.     numbytes = sizeof (buffer);
  966.     cc = 0;
  967.     for ( ; cc != -1 && cc < numbytes ; numbytes -= cc, ptr += cc) {
  968.     cc = read(monClient_ReadPort, ptr, numbytes);
  969.     if (*(ptr + cc - 1) == '\0') {
  970.         /* came to end of string */
  971.         break;
  972.     }
  973.     }
  974.     if (cc == -1) {
  975.     perror("WishHandleMonitorUpdates, path read: ");
  976.     exit(1);
  977.     }
  978. #endif MON_DEBUG
  979.  
  980.     if (XFindContext(wishDisplay, windowID, wishWindowContext,
  981.         (caddr_t) &aWindow) != 0) {
  982.     Sx_Panic(wishDisplay, "Wish didn't recognize given window.");
  983.     }
  984.     /*
  985.      * leave aWindow->firstElement the same so that scrolling and such
  986.      * doesn't change.  Later, worry about selection changing.  Also,
  987.      * make sure we're in the same directory as the window we are redoing.
  988.      */
  989.     if (strcmp(wishCurrentDirectory, aWindow->dir) != 0) {
  990.     if (chdir(aWindow->dir) != 0) {
  991.         sprintf(wishErrorMsg, "%s %s.  %s %s",
  992.             "Couldn't change back to directory", aWindow->dir,
  993.             "Does it still exist?  This window no longer makes",
  994.             "sense and will now disappear.");
  995.         aWindow->notifierP = TRUE;
  996.         Sx_Notify(wishDisplay, aWindow->displayWindow, -1, -1, 0,
  997.             wishErrorMsg, NULL, TRUE, "Continue", NULL);
  998.         aWindow->notifierP = FALSE;
  999.         (void) WishDoCmd(aWindow, "close");
  1000.         return;
  1001.     }
  1002.     strcpy(wishCurrentDirectory, aWindow->dir);
  1003.     }
  1004.     firstElement = aWindow->firstElement;
  1005.     WishGarbageCollect(aWindow);
  1006.     WishSourceConfig(aWindow);
  1007.     aWindow->firstElement = firstElement;
  1008.     WishSetPositions(aWindow);
  1009.     /* WishRedraw will be called from event caused in WishSetPositions() */
  1010.  
  1011.     return;
  1012. }
  1013. @
  1014.  
  1015.  
  1016. 1.3
  1017. log
  1018. @Fixed many bugs - notifiers no longer trash the display.
  1019. @
  1020. text
  1021. @d18 1
  1022. a18 1
  1023. static char rcsid[] = "$Header: /a/newcmds/wish/RCS/wishHandlers.c,v 1.2 88/11/02 14:50:38 mlgray Exp Locker: mlgray $ SPRITE (Berkeley)";
  1024. d28 2
  1025. d394 2
  1026. a395 1
  1027.     FILE    *test;
  1028. d414 3
  1029. d418 1
  1030. d423 1
  1031. a423 1
  1032.     if ((test = fopen(string, "r")) != NULL) {
  1033. d427 1
  1034. a427 1
  1035.         (void) fclose(test);
  1036. d437 1
  1037. a437 1
  1038.     if ((test = fopen(".wish", "r")) != NULL) {
  1039. d444 19
  1040. a462 1
  1041.     (void) fclose(test);
  1042. @
  1043.  
  1044.  
  1045. 1.2
  1046. log
  1047. @fsflat changed to wish
  1048. @
  1049. text
  1050. @d18 1
  1051. a18 1
  1052. static char rcsid[] = "$Header: wishHandlers.c,v 1.1 88/10/03 12:48:12 mlgray Exp $ SPRITE (Berkeley)";
  1053. d144 1
  1054. d147 1
  1055. d239 1
  1056. d242 1
  1057. d260 1
  1058. d263 1
  1059. d273 1
  1060. d276 1
  1061. d597 1
  1062. a597 1
  1063.     button |= FSFLAT_LEFT_BUTTON;
  1064. d600 1
  1065. a600 1
  1066.     button |= FSFLAT_MIDDLE_BUTTON;
  1067. d603 1
  1068. a603 1
  1069.     button |= FSFLAT_RIGHT_BUTTON;
  1070. d641 1
  1071. a641 1
  1072.     if (button != FSFLAT_LEFT_BUTTON) {    /* not selection */
  1073. d722 1
  1074. d725 1
  1075. d793 1
  1076. d796 1
  1077. d801 3
  1078. a803 1
  1079.             "The keystroke sequence\n\"%s\"\nhas no function.", msg);
  1080. d807 1
  1081. d931 1
  1082. d934 1
  1083. @
  1084.  
  1085.  
  1086. 1.1
  1087. log
  1088. @Initial revision
  1089. @
  1090. text
  1091. @d2 1
  1092. a2 1
  1093.  * fsflatHandlers.c --
  1094. d18 1
  1095. a18 1
  1096. static char rcsid[] = "$Header: fsflatHandlers.c,v 1.6 88/06/10 13:14:52 mlgray Exp $ SPRITE (Berkeley)";
  1097. d26 1
  1098. a26 1
  1099. #include "fsflatInt.h"
  1100. d32 1
  1101. a32 1
  1102.  * FsflatToggleSelection --
  1103. d48 1
  1104. a48 1
  1105. FsflatToggleSelection(window, eventPtr, lineP)
  1106. d54 1
  1107. a54 1
  1108.     FsflatWindow    *aWindow;
  1109. d61 1
  1110. a61 1
  1111.     if (XFindContext(fsflatDisplay, window, fsflatWindowContext,
  1112. d63 1
  1113. a63 1
  1114.     Sx_Panic(fsflatDisplay, "Fsflat didn't recognize given window.");
  1115. d72 1
  1116. a72 1
  1117.     (void) FsflatDoCmd(aWindow, buffer);
  1118. d81 1
  1119. a81 1
  1120.  * FsflatEditRule --
  1121. d103 1
  1122. a103 1
  1123. FsflatEditRule(window, eventPtr)
  1124. d107 2
  1125. a108 2
  1126.     FsflatWindow    *aWindow;
  1127.     FsflatGroup        *groupPtr;
  1128. d118 1
  1129. a118 1
  1130.     if (XFindContext(fsflatDisplay, window, fsflatWindowContext,
  1131. d120 1
  1132. a120 1
  1133.     Sx_Panic(fsflatDisplay, "Fsflat didn't recognize given window.");
  1134. d122 1
  1135. a122 1
  1136.     if (XFindContext(fsflatDisplay, window, fsflatGroupWindowContext,
  1137. d124 1
  1138. a124 1
  1139.     Sx_Panic(fsflatDisplay, "Fsflat didn't recognize given header window.");
  1140. d141 1
  1141. a141 1
  1142.     sprintf(fsflatErrorMsg, "%s %s %s.", "Currently it is only possible to",
  1143. d144 2
  1144. a145 2
  1145.     Sx_Notify(fsflatDisplay, aWindow->displayWindow, -1, -1, 0,
  1146.         fsflatErrorMsg, NULL, TRUE, "Continue", NULL);
  1147. d148 1
  1148. a148 1
  1149.     Sx_EntryMake(fsflatDisplay, groupPtr->headerWindow, NULL,
  1150. d160 1
  1151. a160 1
  1152.     if (FsflatDoCmd(aWindow, buffer) != TCL_OK) {
  1153. d163 1
  1154. a163 1
  1155.     Sx_EntryMake(fsflatDisplay, groupPtr->headerWindow, NULL,
  1156. d178 1
  1157. a178 1
  1158.  * FsflatEditDir --
  1159. d184 1
  1160. a184 1
  1161.  *    dir. If a proper node has been chosen, call FsflatChangeDir() with it.
  1162. d198 1
  1163. a198 1
  1164. FsflatEditDir(window, eventPtr)
  1165. d203 1
  1166. a203 1
  1167.     FsflatWindow    *aWindow;
  1168. d212 1
  1169. a212 1
  1170.     if (XFindContext(fsflatDisplay, window, fsflatWindowContext,
  1171. d214 1
  1172. a214 1
  1173.     Sx_Panic(fsflatDisplay, "Fsflat didn't recognize a given window.");
  1174. d237 1
  1175. a237 1
  1176.     Sx_Notify(fsflatDisplay, aWindow->surroundingWindow, -1, -1, 0,
  1177. d240 1
  1178. a240 1
  1179.     Sx_EntryMake(fsflatDisplay, aWindow->titleWindow, "Directory:  ",
  1180. d253 1
  1181. a253 1
  1182.     sprintf(fsflatErrorMsg,
  1183. d256 2
  1184. a257 2
  1185.     Sx_Notify(fsflatDisplay, aWindow->surroundingWindow, -1, -1, 0,
  1186.         fsflatErrorMsg, NULL, TRUE, "Skip command", (char *) NULL);
  1187. d259 1
  1188. a259 1
  1189.     Sx_EntryMake(fsflatDisplay, aWindow->titleWindow, "Directory:  ",
  1190. d266 3
  1191. a268 3
  1192.     sprintf(fsflatErrorMsg, "%s is not a directory.", aWindow->editDir);
  1193.     Sx_Notify(fsflatDisplay, aWindow->surroundingWindow, -1, -1, 0,
  1194.         fsflatErrorMsg, NULL, TRUE, "Skip command", (char *) NULL);
  1195. d270 1
  1196. a270 1
  1197.     Sx_EntryMake(fsflatDisplay, aWindow->titleWindow, "Directory:  ",
  1198. d276 1
  1199. a276 1
  1200.     FsflatChangeDir(aWindow, aWindow->editDir);
  1201. d285 1
  1202. a285 1
  1203.  * FsflatChangeDir --
  1204. d303 2
  1205. a304 2
  1206. FsflatChangeDir(aWindow, where)
  1207.     FsflatWindow    *aWindow;
  1208. d315 1
  1209. a315 1
  1210.     Sx_EntryMake(fsflatDisplay, aWindow->titleWindow, "Directory:  ",
  1211. d322 2
  1212. a323 2
  1213.     sprintf(fsflatErrorMsg, "Couldn't change directories to %s", where);
  1214.     Sx_Panic(fsflatDisplay, fsflatErrorMsg);
  1215. d326 1
  1216. a326 1
  1217.     sprintf(fsflatErrorMsg, "FsflatChangeDir: %s",
  1218. d328 1
  1219. a328 1
  1220.     Sx_Panic(fsflatDisplay, fsflatErrorMsg);
  1221. d334 1
  1222. a334 1
  1223.     Sx_EntryMake(fsflatDisplay, aWindow->titleWindow, "Directory:  ",
  1224. d338 4
  1225. a341 1
  1226.     FsflatGarbageCollect(aWindow);
  1227. d343 1
  1228. a343 1
  1229.     strcpy(fsflatCurrentDirectory, aWindow->dir);
  1230. d345 1
  1231. a345 1
  1232.     FsflatSourceConfig(aWindow);
  1233. d348 2
  1234. a349 2
  1235.     FsflatSetPositions(aWindow);
  1236.     /* FsflatRedraw will be called from event caused in FsflatSetPositions() */
  1237. d352 3
  1238. a354 3
  1239.         strlen(fsflatCurrentDirectory) + 4);
  1240.     sprintf(insertcommand, "%s %s\\n", command, fsflatCurrentDirectory);
  1241.     Tx_Command(fsflatDisplay, aWindow->txOutsideWindow, insertcommand);
  1242. d364 1
  1243. a364 1
  1244.  * FsflatSourceConfig --
  1245. d377 2
  1246. a378 2
  1247. FsflatSourceConfig(aWindow)
  1248.     FsflatWindow    *aWindow;
  1249. d411 1
  1250. a411 1
  1251.         (void) FsflatDoCmd(aWindow, string);
  1252. d416 1
  1253. a416 1
  1254.     /* What if results of void'd FsflatDoCmd()'s were not TCL_OK? */
  1255. d427 1
  1256. a427 1
  1257.         (void) FsflatDoCmd(aWindow, "source .wish");
  1258. d434 1
  1259. a434 1
  1260.     if (FsflatGatherNames(aWindow) != TCL_OK) {
  1261. d450 1
  1262. a450 1
  1263.  * FsflatHandleDrawingEvent --
  1264. d464 2
  1265. a465 2
  1266. FsflatHandleDrawingEvent(aWindow, eventPtr)
  1267.     FsflatWindow    *aWindow;
  1268. d481 1
  1269. a481 1
  1270.     XGetGeometry(fsflatDisplay, aWindow->displayWindow, &dummy2,
  1271. d485 1
  1272. a485 1
  1273.         (void) FsflatDoCmd(aWindow, buffer);
  1274. d489 1
  1275. a489 1
  1276.     (void) FsflatDoCmd(aWindow, buffer);
  1277. d499 1
  1278. a499 1
  1279.     (void) FsflatDoCmd(aWindow, buffer);
  1280. d511 1
  1281. a511 1
  1282.  * FsflatHandleDestructionEvent --
  1283. d526 2
  1284. a527 2
  1285. FsflatHandleDestructionEvent(aWindow, eventPtr)
  1286.     FsflatWindow    *aWindow;
  1287. d537 1
  1288. a537 1
  1289.  * FsflatMouseEvent --
  1290. d552 1
  1291. a552 1
  1292. FsflatMouseEvent(window, eventPtr)
  1293. d562 3
  1294. a564 3
  1295.     FsflatFile    *filePtr;
  1296.     FsflatGroup    *groupPtr;
  1297.     FsflatWindow    *aWindow;
  1298. d580 1
  1299. a580 1
  1300.     FsflatHighlightMovement(window, eventPtr);
  1301. d609 1
  1302. a609 1
  1303.     if (XFindContext(fsflatDisplay, window, fsflatWindowContext,
  1304. d611 1
  1305. a611 1
  1306.     Sx_Panic(fsflatDisplay, "Fsflat didn't recognize given window.");
  1307. d613 1
  1308. a613 1
  1309.     filePtr = FsflatMapCoordsToFile(aWindow, x, y);
  1310. d616 1
  1311. a616 1
  1312.     command = FsflatGetGroupBinding(groupPtr, button);
  1313. d620 1
  1314. a620 1
  1315.         (void) FsflatDoCmd(aWindow, command);
  1316. d637 1
  1317. a637 1
  1318.     if (button != FsflatWhichButton(selectButton)) {    /* not select.*/
  1319. d663 1
  1320. a663 1
  1321.     (void) FsflatDoCmd(aWindow, buffer);
  1322. d665 1
  1323. a665 1
  1324.     FsflatToggleSelection(window, eventPtr, TRUE);
  1325. d671 1
  1326. a671 1
  1327.     (void) FsflatDoCmd(aWindow, buffer);
  1328. d673 1
  1329. a673 1
  1330.     FsflatToggleSelection(window, eventPtr, FALSE);
  1331. d684 1
  1332. a684 1
  1333.  * FsflatHandleEnterEvent --
  1334. d699 2
  1335. a700 2
  1336. FsflatHandleEnterEvent(aWindow, eventPtr)
  1337.     FsflatWindow    *aWindow;
  1338. d706 1
  1339. a706 1
  1340.     if (strcmp(fsflatCurrentDirectory, aWindow->dir) == 0) {
  1341. d710 1
  1342. a710 1
  1343.     sprintf(fsflatErrorMsg, "%s %s.  %s %s",
  1344. d714 3
  1345. a716 3
  1346.     Sx_Notify(fsflatDisplay, aWindow->displayWindow, -1, -1, 0,
  1347.         fsflatErrorMsg, NULL, TRUE, "Continue", NULL);
  1348.     (void) FsflatDoCmd(aWindow, "close");
  1349. d719 1
  1350. a719 1
  1351.     strcpy(fsflatCurrentDirectory, aWindow->dir);
  1352. d729 1
  1353. a729 1
  1354.  * FsflatKeyProc --
  1355. d732 1
  1356. a732 1
  1357.  *    key is typed in an Fsflat window.
  1358. d743 2
  1359. a744 2
  1360. FsflatKeyProc(aWindow, eventPtr)
  1361.     FsflatWindow    *aWindow;    /* Keeps track of information for
  1362. d777 1
  1363. a777 1
  1364.         FsflatCvtToPrintable(command, 30, msg);
  1365. d781 1
  1366. a781 1
  1367.         sprintf(fsflatErrorMsg,
  1368. d783 1
  1369. a783 1
  1370.         Sx_Notify(fsflatDisplay, w, -1, -1, 0, fsflatErrorMsg,
  1371. d788 1
  1372. a788 1
  1373.         sprintf(fsflatErrorMsg,
  1374. d790 2
  1375. a791 2
  1376.         (void) Sx_Notify(fsflatDisplay, aWindow->surroundingWindow,
  1377.             -1, -1, 0, fsflatErrorMsg, aWindow->fontPtr, TRUE,
  1378. d824 1
  1379. a824 1
  1380.         (void) FsflatDoCmd(aWindow, command);
  1381. d844 1
  1382. a844 1
  1383.  * FsflatHandleMonitorUpdates --
  1384. d849 1
  1385. a849 1
  1386.  *    that in FsflatHandlerEnterEvent().  This means I should have
  1387. d861 1
  1388. a861 1
  1389. FsflatHandleMonitorUpdates()
  1390. d867 1
  1391. a867 1
  1392.     FsflatWindow    *aWindow;
  1393. d880 1
  1394. a880 1
  1395.     perror("FsflatHandleMonitorUpdates, windowID read: ");
  1396. d896 1
  1397. a896 1
  1398.     perror("FsflatHandleMonitorUpdates, path read: ");
  1399. d901 1
  1400. a901 1
  1401.     if (XFindContext(fsflatDisplay, windowID, fsflatWindowContext,
  1402. d903 1
  1403. a903 1
  1404.     Sx_Panic(fsflatDisplay, "Fsflat didn't recognize given window.");
  1405. d910 1
  1406. a910 1
  1407.     if (strcmp(fsflatCurrentDirectory, aWindow->dir) != 0) {
  1408. d912 1
  1409. a912 1
  1410.         sprintf(fsflatErrorMsg, "%s %s.  %s %s",
  1411. d916 3
  1412. a918 3
  1413.         Sx_Notify(fsflatDisplay, aWindow->displayWindow, -1, -1, 0,
  1414.             fsflatErrorMsg, NULL, TRUE, "Continue", NULL);
  1415.         (void) FsflatDoCmd(aWindow, "close");
  1416. d921 1
  1417. a921 1
  1418.     strcpy(fsflatCurrentDirectory, aWindow->dir);
  1419. d924 2
  1420. a925 2
  1421.     FsflatGarbageCollect(aWindow);
  1422.     FsflatSourceConfig(aWindow);
  1423. d927 2
  1424. a928 2
  1425.     FsflatSetPositions(aWindow);
  1426.     /* FsflatRedraw will be called from event caused in FsflatSetPositions() */
  1427. @
  1428.